<template>
    <div class="container">
        <div v-if="store.curUser">
            欢迎您:{{ store.curUser.user_name }}<br/>
            <span @click="logout">注销</span>
        </div>
        <!-- <div v-else>
            <router-link to="/login">登录</router-link>
        </div> -->
    </div>
</template>

<script>
import { useUserStore } from '../store/UserStore';
export default {
    data: () => {
        return{
            store:useUserStore()
        }
    },
    methods: {
        logout(){
            this.store.logout();
            this.$router.push('/login');
        }

    }
}
</script>

<style scoped>
.container{
    margin-right: 50px;
}
.container span{
    cursor: pointer;
}
</style>